-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add debug_assert_ne + assert_ne #35074
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
9812ee7
to
ee12bde
Compare
/// assert_ne!(a, b); | ||
/// ``` | ||
#[macro_export] | ||
///#[stable(feature = "????", since = "????")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what to put here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macros are a bit odd, since they become insta-stable. Right now, since
should be 1.12.0
. Unsure about feature
, since it won't have one. @alexcrichton ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the feature effectively doesn't matter -- assert_ne
would be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(what @aturon said)
hi! does this need tests? i'm struggling to find where would love some direction on where/if to write tests. otherwise i think this should be good to go! |
c469651
to
123a54a
Compare
ok! tests added. thanks for the point in the right direction @steveklabnik 🐬 |
@@ -0,0 +1,12 @@ | |||
#[derive(PartialEq, Debug)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may need our standard license header to pass make tidy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, @steveklabnik said it didn't, but i'll add it
fa0eb14
to
3f404f4
Compare
@bors: r+ 3f404f40d01f8a3f03d2ad219f81cb236d416f15 |
lemme know if you'd like me to squash ;) |
⌛ Testing commit 3f404f4 with merge aa5ce78... |
💔 Test failed - auto-linux-64-nopt-t |
@ashleygwilliams sure! Looks like the stability attributes may also need to be uncommented? |
76ddf5d
to
ec8a8ef
Compare
@bors: r+ |
📌 Commit ec8a8ef has been approved by |
⌛ Testing commit ec8a8ef with merge 8e68479... |
💔 Test failed - auto-mac-64-opt-rustbuild |
Hmm, I don't see why this failed. |
Hm I guess maybe that could be a bug in rustbuild where it's using the wrong standard library, but I'd be surprised if that just came up! @ashleygwilliams does |
@ashleygwilliams of did you pass
|
am waiting on it now @alexcrichton |
fails the same on my local machine as it fails in travis. |
Oh right these macros are defined in libcore but need to be reexported from the standard library |
lol omg I KNEW IT. i had been bugging @steveklabnik about needing to "register" the macros somewhere. commit + squash coming up |
0bafa78
to
8960845
Compare
@@ -302,7 +302,7 @@ use prelude::v1::*; | |||
// We want to reexport a few macros from core but libcore has already been | |||
// imported by the compiler (via our #[no_std] attribute) In this case we just | |||
// add a new crate name so we can attach the reexports to it. | |||
#[macro_reexport(assert, assert_eq, debug_assert, debug_assert_eq, | |||
#[macro_reexport(assert, assert_eq, assert_ne, debug_assert, debug_assert_eq, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug_assert_ne as well?
8960845
to
01d085b
Compare
i am unclear what this means. |
@bors: r+ Ah yeah that's fine, travis is broken right now unfortunately :( |
📌 Commit 01d085b has been approved by |
⌛ Testing commit 01d085b with merge 848e652... |
💔 Test failed - auto-linux-32-nopt-t |
@bors: retry |
🔒 Merge conflict |
/cc @ashleygwilliams , let's get that merge conflict fixed |
01d085b
to
3d8d557
Compare
@bors: r+ |
📌 Commit 3d8d557 has been approved by |
Homu still seems to think this isn't mergeable @alexcrichton :/ |
Actually, it appears it was just a bad cache, it's working now 👍 |
⌛ Testing commit 3d8d557 with merge 53f9730... |
add debug_assert_ne + assert_ne ~~✨ work in progress, please do not merge ✨~~ fixes #35073
This improves navigation and code highlighting inside the following macros: assert!(a == b); debug_assert!(a == b); assert_eq!(a, b); debug_assert_eq!(a, b); assert_ne!(a, b); debug_assert_ne!(a, b); For assert! and debug_assert! format arguments are supported: assert!(a == b, "Some text"); assert!(a == b, "Text {} {} syntax", "with", "format"); Different parenthesis are supported: assert!(a == b); assert![a == b]; assert!{a == b}; Fixes intellij-rust#636 assert_ne! is stable since Rust 1.12. rust-lang/rust#35074
This improves navigation and code highlighting inside the following macros: assert!(a == b); debug_assert!(a == b); assert_eq!(a, b); debug_assert_eq!(a, b); assert_ne!(a, b); debug_assert_ne!(a, b); Format arguments are supported: assert!(a == b, "Text {} {} syntax", "with", "format"); assert!(a == b, "Some text"); assert_eq!(a, b, "Some text"); assert_ne!(a, b, "Some text"); Different parenthesis are supported: assert!(a == b); assert![a == b]; assert!{a == b}; Fixes intellij-rust#636 assert_ne! is stable since Rust 1.12. rust-lang/rust#35074
✨ work in progress, please do not merge ✨fixes #35073